package com.aoip.telemetry.telemetry.configureui.business.order.config.service.impl;

import com.aoip.telemetry.telemetry.configureui.business.order.config.mapper.RelOrderStMapper;
import com.aoip.telemetry.telemetry.configureui.business.order.config.service.OrderConfigService;
import com.aoip.telemetry.telemetry.configureui.common.utils.StringUtils;
import com.aoip.telemetry.telemetry.entity.order.RelOrderStEntity;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author chenbai
 * @version 1.0
 * @date 2022/2/23 17:32
 */
@Service
public class OrderConfigServiceImpl implements OrderConfigService {

    @Resource
    private RelOrderStMapper mapper;

    @Override
    public List<RelOrderStEntity> list(RelOrderStEntity entity) {
        QueryWrapper<RelOrderStEntity> queryWrapper = new QueryWrapper<>();
        String orderId = entity.getOrderId();
        String stCode = entity.getStCode();
        if (StringUtils.isNotEmpty(orderId)) {
            queryWrapper.eq("order_id", orderId);
        }
        if (StringUtils.isNotEmpty(stCode)) {
            queryWrapper.eq("st_code", stCode);
        }
        return mapper.selectList(queryWrapper);
    }


}
